{% extends "base.html" %}

{% block content %}
<div id="content-header">
	<h2>编辑帐户</h2>
	<div class="top-tools">
		<a href="..">返回帐户详情</a>
	</div>
	<div class="clear"></div>
</div>

<form method="post" action=".">
	{% if form.errors %}
	<p class="errornote">请修正下面的错误后继续</p>
	{% endif %}
	<div class="form-row{% if form.name.errors %} error{%endif%}">
		<label for="id_name">账户名称
		{% if form.name.errors %}
		<strong class="error">{{ form.name.errors.0 }}</strong>
		{% endif %}
		</label>
		<input type="text" id="id_name" name="name" value="{{ form.initial.name }}" />
		<p class="help">例如：安慧里租房</p>
	</div>
	<div class="form-buttons">
		<button type="submit" class="button">保存</button>
		<a href="/sa/">取消</a>
	</div>
</form>

<div class="members">
	<h3>成员信息</h3>
<ul>
{% for member in members %}
<li class="object-item {% cycle '' 'alt' %}">
	<div class="main">
		<a href="../member/{{ member.id }}/edit/" class="{% if not member.is_active %}inactive{%endif%}">{{ member.name }}({{ member.user.email }})</a>
		<p class="tools">
			{% ifnotequal account.creator.id member.user.id %}
			<a class="delete delete_member" href="../member/{{ member.id }}/delete/">删除</a>
			{% endifnotequal %}
		</p>
	</div>
</li>
{% endfor %}
</ul>

<div class="bottom-tools">
	<a class="button" href="../member/add/">添加成员</a>
</div>
</div>
{% endblock %}

{% block embedded_javascript %}
(function($) {
	$(function() {
		$("a.delete_member").click(function() {
			if (confirm("确定要删除该成员吗?")) {
				return true;
			}
			return false;
		});
	});
})(jQuery);
{% endblock %}
